from django.db import models

# 类别 category   (name,imgUrl,id) ("新蜂超市","//s.weituibao.com/1583585285461/cs.png",100001),

# 轮播图 ads   (id,img)   insert into ads(id,img) values(1,"https://newbee-mall.oss-cn-beijing.aliyuncs.com/images/banner-mate40.png"),

# 热销商品   hotGoods  (id,sku_name,goodIntro,coverImg,sellingPrice,tag)
# insert into hotGoods(id,sku_name,goodIntro,coverImg,sellingPrice,tag) values
# (10902,"华为 HUAWEI P40 冰霜银 全网通5G手机","麒麟990 5G SoC芯片 5000万超感...","https://newbee-mall.oss-cn-beijing.aliyuncs.com/images/p40-silver.png", 4299,"超感知影像"),

# 新商品 goods  (id,sku_name,good_intro,cover_img,selling_price,tag)
# insert into goods(id,sku_name,good_intro,cover_img,selling_price,tag) values
# (10909,"HUAWEI Mate 40 Pro+ 5G 全网通 12G...","5nm麒麟9000旗舰芯片 | 超感光徕卡电...","https://newbee-mall.oss-cn-beijing.aliyuncs.com/images/mate40pro%2B.png", 7988,"跃见非凡"),

#分类
class Category(models.Model):
    name = models.CharField(max_length=10, verbose_name='分类名')
    imgUrl = models.CharField(max_length=300, verbose_name='图片地址')
    # id = models.IntegerField(max_length=10, verbose_name='id')
    class Meta:
        db_table = 'category'
    def __str__(self):
        return self.name

#轮播图
class Ads(models.Model):
    img = models.CharField(max_length=300, verbose_name='图片地址')
    class Meta:
        db_table = 'ads'
    def __str__(self):
        return '轮播图%d'%self.id


# 热销商品
class HotGoods(models.Model):
    # id = models.IntegerField(max_length=10, verbose_name='id')
    sku_name = models.CharField(max_length=100, verbose_name='商品名')
    goodIntro = models.CharField(max_length=200, verbose_name='商品详情')
    coverImg = models.CharField(max_length=200,verbose_name="商品默认图片")
    sellingPrice = models.DecimalField(max_digits=7, decimal_places=2, verbose_name='价格')
    tag = models.CharField(max_length=50, verbose_name='口号')
    class Meta:
        db_table = 'hotgoods'
    def __str__(self):
        return self.sku_name

    # id,sku_name,good_intro,cover_img,selling_price,tag

# 新商品
class Goods(models.Model):
    # id = models.IntegerField(max_length=10, verbose_name='id')
    sku_name = models.CharField(max_length=100, verbose_name='商品名')
    good_intro = models.CharField(max_length=200, verbose_name='商品详情')
    cover_img = models.CharField(max_length=200, verbose_name="商品默认图片")
    selling_price = models.DecimalField(max_digits=7, decimal_places=2, verbose_name='价格')
    tag = models.CharField(max_length=50, verbose_name='口号')

    class Meta:
        db_table = 'goods'

    def __str__(self):
        return self.sku_name